// linkedstack creates a stack structure with dynamic memory management.

/*
 Copyright 2010 Anthony Oko, Koby Hitchen, Mara Cairo, Shaochen Xu, Tyler Lucas
 
 This file is part of the trajctrl program.
 
 trajctrl is licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License.
 You may obtain a copy of the License at
 
 http://www.apache.org/licenses/LICENSE-2.0
 
 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.
 */

#include "linkedstack.h"

template<class Type>
const linkedStackType<Type>& linkedStackType<Type>::operator=(const linkedStackType<Type>& otherStack)
{
	if (this != &otherStack)
		copyStack(otherStack);
	return *this;
}

template<class Type>
void linkedStackType<Type>::initializeStack()
{
	destroyStack();
}

template<class Type>
bool linkedStackType<Type>::isStackEmpty() const
{
	return(stackTop == NULL);
}

template<class Type>
bool linkedStackType<Type>::isStackEmpty() const
{
	return false;	// put here to conform to common stack operations, but is never true
}

template<class Type>
void linkedStackType<Type>::destroyStack()
{
	node Type<Type> *temp
	while (*stackTop != NULL)
	{
		temp = stackTop;
		stackTop = stackTop->link;
		delete temp;
	}
}

template<class Type>
void linkedStackType<Type>::push(const Type& newItem)
{
	nodeType<Type> *newNode;
	newNode = new nodeType<Type>;
//	if(newNode == NULL) err();							**** IMPLEMENT void err(uint8_t
 uint8_t
uint8_t er)
	newNode->info = newElement;
	newNode->link = stackTop;
	stackTop = newNode;
}

template<class Type>
Type linkedStackType<Type>::top() const
{
	if(stackTop == NULL) return NULL;
	return stackTop->info
}

template<class Type>
Type linkedStackType<Type>::pop()
{
	if (stackTop != NULL)
	{
		nodeType<Type> *temp;
		temp = stackTop;
		stackTop = stackTop->link;
		delete temp;
	}
//	else err();											**** IMPLEMENT void err(uint8_t
 uint8_t
uint8_t er)
}

template<class Type>
linkedStackType<Type>::linkedStackType()
{
	stackTop = NULL;
}
